{include file='fcworker/fc_head'}
<style type="text/css">
    .ac-notice{
        width: 85%;
        margin: 8px auto;
        padding: 25px;
        line-height: 20px;
        color: #6b6b6b;
        text-align: left;
        display: block;
        font-size: 11px;
        box-shadow: 0 0  5px 5px rgba(0, 0, 0, 0.06);
        border-radius: 8px;
    }
    .btn-div{
        width: 100%;
        text-align: center;
        margin: 0 auto;
    }
    .sub-btn{
        background-color: #5c99f7;
        text-align: center;
        border: 0;
        border-radius: 50px;
        margin-top: 20px;
        color: #fff;
        font-size: 15px;
        font-weight: 400;
        width: 184px;
        height: 40px;
        line-height: 40px;
    }
    .qr_code{
        height: 260px;
        width: 260px;
    }
    select{
        appearance: none;
        -moz-appearance: none;
        -webkit-appearance: none;
        -ms-progress-appearance: none;
        position: relative;
        z-index: 999;
    }
    .select_wrap{
        position: relative;
    }
    select+.arrow{
        position: absolute;
        right: 0.28rem;
        bottom: 0.1rem;
        margin: auto 0;
        z-index: 0;
    }
    select+.arrow{
        width: 0;
        height: 0;
        border: 0.16rem solid;
        border-color: #4D4D4D transparent transparent transparent;
    }
    select:focus+.arrow{
        border-color: #57a9ee transparent transparent transparent;

    }
    select+.arrow::after{
        content: '';
        position: absolute;
        top: -0.2rem;
        left: -0.16rem;
        border: 0.16rem solid;
        border-color: white transparent transparent transparent;
    }
</style>
<body style="background:#f8f8f8">
<div id="mescroll" class="mescroll">
    <div id="app">
        <!--<a href="/{php echo createMobileUrl('x_index',array('themeid'=>$themeid));}" class="homeTag"><img src="{$_G['URL']['FCWORK_CSS']}images/homeBtn.png"></a>-->
        <div class="setTitle_h">
            <a href="javascript:history.back(-1)"></a>
            {if $level }线下定单录入 {else}线下定单确认 {/if}
        </div>
        {if !empty($group_name)}
        <div class="setActive">
            {loop $group_name  $key $item}
            <a href="/{php echo createMobileUrl('x_input',array('op'=>'display','renshu'=>$key,'themeid'=>$themeid));}" class="sub-btn " id="sub3" type="button" style="display: block;margin: 0.6rem auto;">{php echo $item;}</a>
            {/loop}
        </div>
        {elseif $method !='bangding_weixin' && (($level && !$qrimg) || !$level)}
        <form id="myform3">
            <div class="setActive">
                <ul>
                    <li>
                        <p class="nametext">{$config['nametext']}</p>
                        <input type="text"  name="username" placeholder-class="input-placeholder" confirm-type="next" value="{$record['username']}" placeholder="请输入{$config['nametext']}" {if !$config['isedit']} disabled{/if}>
                    </li>
                    <li>
                        <p class="mobiletext">{$config['mobiletext']}</p>
                        <input type="tel" maxlength="11"  name="mobile" placeholder-class="input-placeholder" confirm-type="next" value="{$record['mobile']}" placeholder="请输入{$config['mobiletext']}" {if !$config['isedit']} disabled{/if}>
                    </li>
                    <!--            0文本1数字6电话7日期2下拉菜单3单选 4多选-->
                    {if !empty($config['datetime'])}
                    {if $config['datetimetype']==0 || $config['datetimetype']==1 || $config['datetimetype']==6 || $config['datetimetype']==10}
                    <li>
                        <p>{$config['datetime']}</p>
                        <input type="{php echo $config['datetimetype']==0?'text':'number';}"  name="datetime"
                               placeholder-class="input-placeholder" confirm-type="next" value="{$record['datetime']}" placeholder="请输入{$config['datetime']}"
                               {if !$config['isedit']} readonly{/if}>
                    </li>
                    {/if}
                    {if $config['datetimetype']==2 && $config['datetimeoptions']}
                    <li>
                        <p>{$config['datetime']}</p>
                        <select name="datetime"  id="select_datetime" {if !$config['isedit']} disabled{/if}>
                        <option value="" >请选择</option>
                        {loop $config['datetimeoptions']  $key $item}
                        <option value="{$item}" {if $record['datetime'] == $item }selected="selected"{/if} >{$item}</option>
                        {/loop}
                        </select>
                    </li>
                    {/if}
                    {if $config['datetimetype']==3 && $config['datetimeoptions']}
                    <li>
                        <p>{$config['datetime']}</p>
                        <div class="choseBar2">
                            {loop $config['datetimeoptions'] $key $item}
                            <label><input type="radio"  style="height: auto;width: auto;"  {if !$config['isedit']} disabled{/if} name="datetime" value="{$item}" {php echo $record['datetime']==$item?'checked':'';} />{$item}</label>
                            {/loop}
                        </div>
                    </li>
                    {/if}
                    {if $config['datetimetype']==7}
                    <li>
                        <p>{$config['datetime']}</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date_datetime" {if !$config['isedit']} disabled{/if} placeholder="请选择"  name="datetime" value="{$record['datetime']}">
                        </div>
                    </li>
                    {/if}
                    {/if}
                    {if !empty($config['address'])}
                    {if $config['addresstype']==0 || $config['addresstype']==1 || $config['addresstype']==6 || $config['addresstype']==9}
                    <li>
                        <p>{$config['address']}</p>
                        <input type="{php echo $config['addresstype']==0?'text':'number';}"  name="address"
                               placeholder-class="input-placeholder" confirm-type="next" value="{$record['address']}" placeholder="请输入{$config['address']}"
                               {if !$config['isedit']} readonly{/if}>
                    </li>
                    {/if}
                    {if $config['addresstype']==2 && $config['addressoptions']}
                    <li>
                        <p>{$config['address']}</p>
                        <select name="address"  id="select_address" {if !$config['isedit']} disabled{/if}>
                        <option value="" >请选择</option>
                        {loop $config['addressoptions']  $key $item}
                        <option value="{$item}" {if $record['address'] == $item }selected="selected"{/if} >{$item}</option>
                        {/loop}
                        </select>
                    </li>
                    {/if}
                    {if $config['addresstype']==3 && $config['addressoptions']}
                    <li>
                        <p>{$config['address']}</p>
                        <div class="choseBar2">
                            {loop $config['addressoptions'] $key $item}
                            <label><input type="radio"  style="height: auto;width: auto;"  {if !$config['isedit']} disabled{/if} name="address" value="{$item}" {php echo $record['address']==$item?'checked':'';} />{$item}</label>
                            {/loop}
                        </div>
                    </li>
                    {/if}
                    {if $config['addresstype']==7}
                    <li>
                        <p>{$config['address']}</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date_address" {if !$config['isedit']} disabled{/if} placeholder="请选择"  name="address" value="{$record['address']}">
                        </div>
                    </li>
                    {/if}
                    {/if}

                    {if !empty($config['formtwo'])}
                    {if $config['formtwotype']==0 || $config['formtwotype']==1 || $config['formtwotype']==6 || $config['formtwotype']==9 || $config['formtwotype']==10}
                    <li>
                        <p>{$config['formtwo']}</p>
                        <input type="{php echo $config['formtwotype']==0?'text':'number';}"  name="formtwo"
                               placeholder-class="input-placeholder" confirm-type="next" value="{$record['formtwo']}" placeholder="请输入{$config['formtwo']}"
                               {if !$config['isedit']} readonly{/if}>
                    </li>
                    {/if}
                    {if $config['formtwotype']==2 && $config['formtwooptions']}
                    <li>
                        <p>{$config['formtwo']}</p>
                        <select name="formtwo"  id="select_formtwo" {if !$config['isedit']} disabled{/if}>
                        <option value="" >请选择</option>
                        {loop $config['formtwooptions']  $key $item}
                        <option value="{$item}" {if $record['formtwo'] == $item }selected="selected"{/if} >{$item}</option>
                        {/loop}
                        </select>
                    </li>
                    {/if}
                    {if $config['formtwotype']==3 && $config['formtwooptions']}
                    <li>
                        <p>{$config['formtwo']}</p>
                        <div class="choseBar2">
                            {loop $config['formtwooptions'] $key $item}
                            <label><input type="radio"  style="height: auto;width: auto;"  {if !$config['isedit']} disabled{/if} name="formtwo" value="{$item}" {php echo $record['formtwo']==$item?'checked':'';} />{$item}</label>
                            {/loop}
                        </div>
                    </li>
                    {/if}
                    {if $config['formtwotype']==7}
                    <li>
                        <p>{$config['formtwo']}</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date_formtwo" {if !$config['isedit']} disabled{/if} placeholder="请选择"  name="formtwo" value="{$record['formtwo']}">
                        </div>
                    </li>
                    {/if}
                    {/if}
                    {if !empty($config['addinfo'])}
                    {if $config['addinfotype']==0 || $config['addinfotype']==1 || $config['addinfotype']==6}
                    <li>
                        <p>{$config['addinfo']}</p>
                        <input type="{php echo $config['addinfotype']==0?'text':'number';}"  name="addinfo"
                               placeholder-class="input-placeholder" confirm-type="next" value="{$record['addinfo']}" placeholder="请输入{$config['addinfo']}"
                               {if !$config['isedit']} readonly{/if}>
                    </li>
                    {/if}
                    {if $config['addinfotype']==2 && $config['addinfooptions']}
                    <li>
                        <p>{$config['addinfo']}</p>
                        <select name="addinfo"  id="select_addinfo" {if !$config['isedit']} disabled{/if}>
                        <option value="" >请选择</option>
                        {loop $config['addinfooptions']  $key $item}
                        <option value="{$item}" {if $record['addinfo'] == $item }selected="selected"{/if} >{$item}</option>
                        {/loop}
                        </select>
                    </li>
                    {/if}
                    {if $config['addinfotype']==3 && $config['addinfooptions']}
                    <li>
                        <p>{$config['addinfo']}</p>
                        <div class="choseBar2">
                            {loop $config['addinfooptions'] $key $item}
                            <label><input type="radio"  style="height: auto;width: auto;"  {if !$config['isedit']} disabled{/if} name="addinfo" value="{$item}" {php echo $record['addinfo']==$item?'checked':'';} />{$item}</label>
                            {/loop}
                        </div>
                    </li>
                    {/if}
                    {if $config['addinfotype']==7}
                    <li>
                        <p>{$config['addinfo']}</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date_addinfo" {if !$config['isedit']} disabled{/if} placeholder="请选择"  name="addinfo" value="{$record['addinfo']}">
                        </div>
                    </li>
                    {/if}
                    {/if}
                    {if !empty($config['shops'])}
                    {if $config['shopstype']==0 || $config['shopstype']==1 || $config['shopstype']==6 || $config['shopstype']==9}
                    <li>
                        <p>{$config['shops']}</p>
                        <input type="{php echo $config['shopstype']==0?'text':'number';}"  name="shops"
                               placeholder-class="input-placeholder" confirm-type="next" value="{$record['shops']}" placeholder="请输入{$config['shops']}"
                               {if !$config['isedit']} readonly{/if}>
                    </li>
                    {/if}
                    {if $config['shopstype']==2 && $config['shopsoptions']}
                    <li>
                        <p>{$config['shops']}</p>
                        <select name="shops"  id="select_shops" {if !$config['isedit']} disabled{/if}>
                        <option value="" >请选择</option>
                        {loop $config['shopsoptions']  $key $item}
                        <option value="{$item}" {if $record['shops'] == $item }selected="selected"{/if} >{$item}</option>
                        {/loop}
                        </select>
                    </li>
                    {/if}
                    {if $config['shopstype']==3 && $config['shopsoptions']}
                    <li>
                        <p>{$config['shops']}</p>
                        <div class="choseBar2">
                            {loop $config['shopsoptions'] $key $item}
                            <label><input type="radio"  style="height: auto;width: auto;"  {if !$config['isedit']} disabled{/if} name="shops" value="{$item}" {php echo $record['shops']==$item?'checked':'';} />{$item}</label>
                            {/loop}
                        </div>
                    </li>
                    {/if}
                    {if $config['shopstype']==7}
                    <li>
                        <p>{$config['shops']}</p>
                        <div class="layui-input-inline">
                            <input type="text" class="layui-input" id="date_shops" {if !$config['isedit']} disabled{/if} placeholder="请选择"  name="shops" value="{$record['shops']}">
                        </div>
                    </li>
                    {/if}
                    {/if}

                    {if $config['shopstype']==4 && $config['shops'] && $config['shopsoptions']}
                    <li>
                        <p>{$config['shops']}</p>
                        <div class="moreChose">
                            {loop $selectedArr $key $item}
                            <input type="checkbox" style="height: auto;width: auto;" {if !$config['isedit']} disabled{/if}  name="formduoxuanvalue"  value="{$item['name']}" {if $item['checked']} checked="checked"{/if}>{$item['name']}
                            {/loop}
                        </div>
                    </li>
                    {/if}
<!--                    分类多选-->
                    {if $config['shopstype']==8 && $config['shops'] && $config['shopsoptions']}
                    <li>
                        <p>{$config['shops']}</p>
                        <div class="shops_category_all">
                            {if $dx_cate && is_array($dx_cate)}
                            {loop $dx_cate $k $val}
                            <div class="shops_category" style="margin-bottom: 8px;">
                                <div class="shops_category_title">{$val['name']}</div>
                                <div class="shops_category_list" style="display: flex;justify-content: space-around;flex-direction: column;">
                                    {loop $val['list'] $key $item}
                                    <?php  $item_can_show = \app\model\Common::getFormFIveAndLimitBuyCanShowByItemId($baseinfo['config'],$themeid,$item['id']);?>
                                    {if $item['status']==1}
                                    <div class="shops_category_list_item" style="display: flex;align-items: center;height: 30px;line-height: 30px">
                                        <input type="checkbox" style="height: auto;width: auto;" {if !$config['isedit']} disabled{/if}  name="formduoxuanvalue" data-cid="{$val['cid']}" data-sjid="{$val['sj_id']}" data-cmin="{$val['min']}"
                                        data-cmax="{$val['max']}" data-price="{$item['price']}" data-category="{$val['name']}" data-isdefault="{$item['is_default']}" value="{$item['id']}" {if $item['is_default']} checked="checked"{/if}>{$item['name']}
                                        {if !$item_can_show}(库存不足){/if}
                                    </div>
                                    {/if}
                                    {/loop}
                                </div>
                            </div>
                            {/loop}
                            {/if}
                        </div>
                    </li>
                    {/if}

            {if $feelistoption && $level}
            <li class="select_wrap">
                <p>线下收款金额</p>
                <select name="feelist_order"  id="select_feelist_order">
                    {loop $feelistoption $key $item}
                    <option value="{$key}" >{php echo $item['fullname'];}</option>
                    {/loop}
                </select>
                <i class="arrow"></i>
            </li>
            {/if}

            {if $level }
            <li>
                <p>客户来源</p>
                <select name="is_member" style="font-size: .28rem">
                    {loop $result['member_from'] $key $item}
                    <option value="{$key}" {if $record['is_member'] == $key }selected="selected"{/if}>{$item}</option>
                    {/loop}
                </select>
            </li>
            <li>
                <p>{php echo $system['is_member_points']==1?'会员积分':'储值卡余额';}</p>
                <input type="text" name="chongzhi" confirm-type="next" value="{$record['chongzhi']}">
            </li>
            <li>
                <p>备注</p>
                <input type="text" id="member_beizhu" name="member_beizhu" confirm-type="next" value="{$record['member_beizhu']}">
            </li>
            {/if}
        </ul>
    </div>
    <div class="btn-div">

                {if $level}<button class="sub-btn " id="sub3" type="button">提交录入</button>{else}
                <button class="sub-btn " id="sub4" type="button">确认无误</button>
                {/if}
            </div>
        </form>
        {/if}
        <input type="hidden" name="recordid" id="recordid" value="{$recordid}">
        {if $method =='bangding_weixin'}
        <div class="setActive" id="showImg" >
            {else}
            <div class="setActive" id="showImg" style="display: none">
                {/if}
                <ul>
                    <li>
                        <p >{$config['nametext']}</p>
                        <input type="text"  id="nametext" name="username" placeholder-class="input-placeholder" confirm-type="next" value="{$record['username']}" placeholder="请输入{$config['nametext']}">
                    </li>
                    <li>
                        <p >{$config['mobiletext']}</p>
                        <input type="tel"  maxlength="11" id="mobiletext" name="mobile" placeholder-class="input-placeholder" confirm-type="next" value="{$record['mobile']}" placeholder="请输入{$config['mobiletext']}">
                    </li>
                </ul>
                <div style="text-align: center;margin: 20px auto;">
                    <img src="{$inputurl}" class="qr_code" id="qr_code">
                </div>
                <div style="width: 100%;margin: 0 auto;text-align: center;">
                    <button id="listen_btn" type="button" style="width: 80%;height: 40px;line-height: 40px;border-radius: 20px;border:none;background-color: #5c99f7;color: #fff;font-weight: 400;font-size: 15px;">截屏邀约客户扫码进行绑定</button>
                </div>
            </div>
            {if !empty($myworker)}
            <div class="ac-notice">
                <div >1.当客户无法线上付款时，我们可使用线下录入，让客户依旧线上组团，并且方便我们做线上的数字统计</div>
                <div >2.流程：录入客户姓名电话，让客户扫描出现的二维码即完成</div>
                <div >3.如何修改？线下定单临时不可修改，如遇录错录重请在电脑版管理后台，订单管理中进行删除，然后重新线下录入</div>
                <div >4.钱去哪了？线下录入并未收款，款项一般由员工线下收取，员工进行正常的财务交账，款项无法录到系统内</div>
            </div>
            {/if}
            <div>

            </div>
            {include file='fcworker/fc_foot_yixuan'}
    </div>
</div>

</body>
</html>
<script type="text/javascript">
    const mescroll = new MeScroll("mescroll", {
        down: {
            auto: false,
            callback: () => {
                mescroll.endSuccess();
                setTimeout(() => {
                    window.location.reload();
                },500)
            }
        },
        up: {
            use: false
        }
    })
    var getinput;
    let feelistoption = '<?php echo json_encode($feelistoption);?>';
    feelistoption = eval(feelistoption);
    var method = "{$method}";

    var datetime = "{$config['datetime']}";
    var address = "{$config['address']}";
    var formtwo = "{$config['formtwo']}";
    var addinfo = "{$config['addinfo']}";
    var shops = "{$config['shops']}";
    var shopstype = "{$shopstype}";
    //多选分类点击事件
    let shopsmin = "{$config['shopsmin']}"//分类最小选择数
    let shopsmax = "{$config['shopsmax']}"//分类最多选择数
    let shopstitle = "{$config['shops']}"//
    let wait_pay_amount = 0;//多选支付金额
    $(".shops_category_list_item input[name='formduoxuanvalue']").change(function () {
        let c_min = $(this).data("cmin");
        let c_max = $(this).data("cmax");
        let price = $(this).data("price");
        let category = $(this).data("category");
        let is_default = $(this).data("isdefault");
        let is_checked = $(this).prop("checked");
        if (is_default==1){
            //必选禁止取消
            $(this).prop("checked",'checked');
            layer.msg('必选项禁止取消');
            return;
        }
        if (is_checked){
            //判断分类是否合法
           const c =  $(this).parent().parent().find('input:checked');
           //判断最小选择
           if (c_max>0 && c.length>c_max){
               $(this).prop("checked",'');
               let msg = category+'最多选择'+c_max+'项';
               layer.msg(msg);
               return;
           }
        }
        //判断总量是否合法
        const total_check = $(".shops_category_all").find('input:checked');
        if (total_check.length<shopsmin && shopsmin>0){
            let msg = shopstitle+'最少选择'+shopsmin+'项';
            layer.msg(msg);
            return;
        }
        if (total_check.length>shopsmax && shopsmax>0){
            $(this).prop("checked",'');
            let msg = shopstitle+'最多选择'+shopsmax+'项';
            layer.msg(msg);
            return;
        }
    });

    $("#sub3").click(function () {

        $("#sub3").attr("disabled","true");
        var formData3 = $("#myform3").serializeArray();
        let datalist = {};
        $.each(formData3,function (index,item) {
            datalist[item.name] = item.value;
        });
        datalist['op'] = 'save';
        datalist['option'] = datalist['shops'];


        if (feelistoption){
            datalist['realfee'] = feelistoption[datalist['feelist_order']].fee;
            datalist['payname'] = feelistoption[datalist['feelist_order']].name;
        }else{
            datalist['realfee'] = feelistoption[0].fee;
            datalist['payname'] = feelistoption[0].name;
        }

        if (shopstype==4 || shopstype==8){
            var  obj = document.getElementsByName("formduoxuanvalue");
            var formoptiontip=[];
            for(var i in obj){
                if(obj[i].checked){
                    formoptiontip.push(obj[i].value);
                    if (obj[i].dataset.price && Number(obj[i].dataset.price)>0){
                        wait_pay_amount+=Number(obj[i].dataset.price);
                    }
                }
            }
            if (!datalist['formduoxuanvalue']){
                datalist['option'] = formoptiontip;
            }else{
                let str = '';
                $.each(formoptiontip,function (key,it){
                    if (shopstype==8){
                        str+= it + ",";
                    }else{
                        str+= it + "|";
                    }
                })
                datalist['option'] = str;
            }
            if (wait_pay_amount>0){
                datalist['realfee']  = wait_pay_amount;
            }

        }

        var msg = '';
        if (!datalist['username']){
            msg = '请输入'+$('.nametext').html();
            layer.msg(msg);
            $("#sub3").removeAttr("disabled");
            return;
        }
        if (!datalist['mobile'] || datalist['mobile'].length!=11 || !(/^1([3-9])\d{9}$/.test(datalist['mobile']))){
            msg = '请正确输入'+$('.mobiletext').html();
            layer.msg(msg);
            $("#sub3").removeAttr("disabled");
            return;
        }

        if (datetime && !datalist['datetime']){
            layer.msg('请输入'+ datetime);
            $("#sub3").removeAttr("disabled");
            return;
        }
        if (address && !datalist['address']){
            layer.msg('请输入'+ address);
            $("#sub3").removeAttr("disabled");
            return;
        }
        if (formtwo && !datalist['formtwo']){
            layer.msg('请输入'+ formtwo);
            $("#sub3").removeAttr("disabled");
            return;
        }
        if (addinfo && !datalist['addinfo']){
            layer.msg('请输入'+ addinfo);
            $("#sub3").removeAttr("disabled");
            return;
        }
        if (shops && (!datalist['option'] || datalist['option'].length==0)){
            layer.msg('请输入'+ shops);
            $("#sub3").removeAttr("disabled");
            return;
        }

        var postUrl="/{php echo createMobileUrl('X_input',array('themeid'=>$themeid));}";
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data: datalist,
            success:function (e) {
                $("#sub3").removeAttr("disabled");
                let data = e.data;
                let error = e.error;
                let msg = e.msg;
                if (error){
                    console.log(msg)
                    layer.msg(msg);
                    return;
                }else{
                    layer.msg('保存成功');
                    $("#recordid").val(data.record.id);
                    $("#myform3").hide();
                    $("#nametext").val(data.username);
                    $("#mobiletext").val(data.mobile);
                    $("#qr_code").attr('src',data.inputurl);
                    $("#showImg").show();
                    getinput = setInterval(function () {
                        console.log('刷新绑定状态:')
                        getInfo();
                    }, 5000);
                    // window.location.reload();
                }
            },
            fail:function (err) {
            }
        });
    });
    $("#sub4").click(function () {

        var forward = '{php echo $fans['nickname']=='微信用户' || $fans['nickname']=='新用户'?\app\model\Fans::get_login_url($system,$theme):'';}';
        // var forward = '{$forward}';
        if (forward){
            window.location.href=forward;
            return ;
        }

        var recordid = $("#recordid").val();
        if (recordid){
            var postUrl="/{php echo createMobileUrl('X_input',array('themeid'=>$themeid));}";
            var jump_url = "/{php echo createMobileUrl('index',array('themeid'=>$themeid));}"
            $.ajax({
                url:postUrl,
                dataType:'json',
                method:'post',
                data: {op:'bangding',recordid:recordid},
                success:function (e) {
                    let data = e.data;
                    let error = e.error;
                    let msg = e.msg;
                    if (error){
                        layer.msg(msg);
                    }else{
                        layer.msg(data.msg);
                        self.location.href = jump_url;
                    }
                },
                fail:function (err) {
                    alert(err);
                }
            });
        }else{
            layer.msg('发生了意外，请联系工作人员重新创建')
        }

    });


    layui.use('laydate',function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date_datetime'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#date_datetime").val(value);
                }
            }
        });
    });

    layui.use('laydate',function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date_address'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#date_address").val(value);
                }
            }
        });
    });

    layui.use('laydate',function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date_formtwo'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#date_formtwo").val(value);
                }
            }
        });
    });
    layui.use('laydate',function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date_addinfo'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#date_addinfo").val(value);
                }
            }
        });
    });
    layui.use('laydate',function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#date_shops'
            ,type: 'date'
            ,trigger: 'click'
            ,btns: ['confirm']
            ,done:function (value, date, endDate) {
                if (value){
                    $("#date_shops").val(value);
                }
            }
        });
    });

    if (method=='bangding_weixin'){
        console.log(123123)
        getinput = setInterval(function () {
            console.log('刷新绑定状态:')
            getInfo();
        }, 5000);
    }
    function getInfo()
    {
        var recordid = $("#recordid").val();
        console.log(recordid);
        if (recordid){
            var postUrl="/{php echo createMobileUrl('X_input',array('themeid'=>$themeid));}";
            $.ajax({
                url:postUrl,
                dataType:'json',
                method:'post',
                data: {op:'getinfo',recordid:recordid},
                success:function (e) {
                    let data = e.data;
                    let error = e.error;
                    let msg = e.msg;
                    if (error){
                        layer.msg(msg);
                        return;
                    }else{
                        if (data && data.record && data.record.uid>0){
                            let tmp_nickname = data.record.nickname;
                            let diff_nickname = tmp_nickname.substring(0,9);
                            // var temp_txt = '已经成功绑定【'+data.record.nickname + '】';
                            var temp_txt = '已经成功绑定【'+diff_nickname + '】';
                            $("#listen_btn").html(temp_txt);
                            $("#qr_code").attr('src',data.record.avatar);
                            $("#qr_code").css("width", 150);
                            $("#qr_code").css("height", 150)
                            clearTimeout(getinput);
                        }
                    }
                },
                fail:function (err) {
                }
            });
        }
    }
</script>

{if !empty($myworker)}
{include file='fcworker/fc_foot'}
{/if}